<?php
import("com.miho.exceptions.NullPointerException");
class BaseRequest {
	protected $_requestArray;
	protected function initRequestArray($array){
		if (!empty($array)){
			$this->_requestArray = array_combine(array_keys($array),array_values($array));
		}
		unset($array);	
	}
	
	protected function __construct($array){
		if($array===$_POST||$array===$_GET||$array===$_COOKIE||$array===$_FILES){
			$this->initRequestArray($array);
		}else{
			throw new ArgumentException();
		}
	}
	
	public function __get($varName){
		if (!isset($this->_requestArray[$varName])) throw new NullPointerException();
		return $this->_requestArray[$varName];
	}
	
	public function __isset($name){
		return isset($this->_requestArray[$name]);
	}
	
	public function getString($name){
		return (string)$this->$name;
	}
	
	public function getInt($name){
		return (int)$this->$name;
	}
}

?>